package com.cxb.supplier.listener;

import com.cxb.FeignTest;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class MyListener implements ApplicationListener<ApplicationStartedEvent> {
    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        System.out.println("监听到容器启动");
        ConfigurableApplicationContext applicationContext = event.getApplicationContext();
        FeignTest feignTestImpl = (FeignTest) applicationContext.getBean("feignTestImpl");
        feignTestImpl.test();
    }
}
